@W-20474693 - [WebauthN] Passkey Registration#3571
@W-20474693 - [WebauthN] Passkey Registration#3571yunakim714 merged 24 commits intofeature/webauthn-loginfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| @@ -0,0 +1,348 @@ | |||
| /* | |||
There was a problem hiding this comment.
otp-auth files have been pulled from the One click checkout feature branch. This PR reuses the OtpAuth modal created by the 1CC team.
| if (isRegistered && config?.app?.login?.passkey?.enabled) { | ||
| showToast() | ||
| } |
There was a problem hiding this comment.
Only show the Passkey Registration toast if the feature flag is enabled in the config file
| await authorizeWebauthnRegistration.mutateAsync({ | ||
| user_id: customer.email, | ||
| mode: webauthnConfig.mode, | ||
| channel_id: commerceApiConfig.parameters.siteId, | ||
| ...(webauthnConfig.mode === 'callback' && { | ||
| callback_uri: webauthnConfig.callbackURI | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Call to the authorizeWebauthnRegistration AuthHelper
| "auth_modal.info.welcome_user": { | ||
| "defaultMessage": "Welcome {name}," | ||
| }, | ||
| "auth_modal.passkey.button.close.assistive_msg": { |
There was a problem hiding this comment.
@yunakim714 as we don't have a dedicated UX person for this epic, could you start a sheet to keep track of any of the new text we added so that we can get it reviewed by Spencer later?
There was a problem hiding this comment.
Sure! I'll create a sheet for any new Webauthn text labels
There was a problem hiding this comment.
Here is the spreadsheet with text label additions from this PR
https://docs.google.com/spreadsheets/d/1U4MGtzZw-xfW4J9uQFBQvMmO3pYAoEwsYXdK78p-CIY/edit?usp=sharing
packages/template-retail-react-app/app/components/passkey-registration-modal/index.jsx
Outdated
Show resolved
Hide resolved
packages/template-retail-react-app/app/components/passkey-registration-modal/index.jsx
Outdated
Show resolved
Hide resolved
packages/template-retail-react-app/app/components/passkey-registration-modal/index.jsx
Show resolved
Hide resolved
packages/template-retail-react-app/app/pages/checkout/index.jsx
Outdated
Show resolved
Hide resolved
| // We are done with the modal. | ||
| onClose() | ||
|
|
||
| if ((loggingIn || registering) && customer.data && config?.app?.login?.passkey?.enabled) { |
There was a problem hiding this comment.
I'm finding that when registering using the auth-modal, it doesn't show the create passkey toast. It looks like its because customer.data is undefined right after registering.
Also I see this code block repeated a couple times. When a user logs in or registers they seem to always be redirected to the /accounts page (except during passwordless login with a redirect). Would we consider moving this logic to only be called in the accounts page?
I think we can ignore the passwordless case, because if a user is shopping and they want to quickly checkout we may not want to prompt to create a passkey.
There was a problem hiding this comment.
Not sure if this is the desired behavior, but sometimes when I log in from the auth modal on the home page, I am not navigated to the account page.
Also, if we only added this code block on the account page - we would have to use a session item to identify when the user is navigated here from a successful login / account creation. I could switch to this approach if needed! For now, I resolved the bug where this doesn't show up when registering via auth modal
There was a problem hiding this comment.
I'm testing out the login from auth and I also see sometimes it redirects to the accounts page and sometimes does not 🤔
Looking at the code, it seems like logging in from use-auth-modal should not redirect to the accounts page because onLoginSuccess() is noop. Wonder if this is a bug.
But with that said what you have makes sense.
| // Navigate after passkey check completes (whether toast is shown or not) | ||
| navigate(redirectTo) | ||
| }) | ||
| return |
There was a problem hiding this comment.
nit: could we remove the return and navigate(redirectTo) and let line 211 handle it?
Description
This PR implements the passkey registration functionality.
Types of Changes
Changes
How Passkey Registration works:
a. AuthModal
b. Login page
c.
Checkout paged. Register page (when creating an account)
authorizeWebauthnRegistrationAuthHelper incommerce-sdk-reacta. W-20474693 - [PWA Kit][WebAuthn][Passkey Registration] Implement Passkey nickname creation and authorization
How to Test-Drive This PR
To test e2e:
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization